#include <iostream>
#include <vector>
#include <stack>
using namespace std;
class Solution {
public:
    int calculate(string s) {
        stack<int> st;
        char ch = '+';
        int tmp = 0;
        int n = s.size();
        for (int i = 0; ; i++)
        {
            if (i < n && s[i] >= '0' && s[i] <= '9') {
                tmp = tmp * 10 + (s[i] - '0');
            } else if (i < n && s[i] == ' ') {
                continue;
            } else {
                if (ch == '+') {
                    printf("+%d ", tmp);
                    st.push(tmp);
                }
                else if (ch == '-') {
                    printf("-%d ", tmp);
                    st.push(-tmp);
                }
                else if (ch == '*') {
                    int top = st.top();
                    st.pop();
                    printf("%d*%d=%d ", top, tmp, top * tmp);
                    st.push(top * tmp);
                }
                else if (ch == '/') {
                    int top = st.top();
                    st.pop();
                    st.push(top / tmp);
                    printf("%d/%d=%d ", top, tmp, top / tmp);
                }
                tmp = 0;
                ch = s[i];
                if (i == n)
                    break;
            }
        }
        int ret = 0;
        while (!st.empty())
        {
            ret += st.top();
            st.pop();
        }
        return ret;
    }
};

int main()
{
    Solution sol;
    int ret = sol.calculate(" 3/2 ");
    cout << ret << endl;
    return 0;
}